<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <meta name="layout" content="main" />
        <title>Show Person</title>
    </head>
    <body>
        <div class="body">
            <h1>志工</h1>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <div class="dialog">
                <table>
                    <tbody>

 						<tr class="prop">
                            <td valign="top" class="name">字號:</td>
                            <td valign="top" class="value">${fieldValue(bean:personInstance, field:'uid')}</td>
                        </tr>

                        <tr class="prop">
                            <td valign="top" class="name">姓名:</td>
                            <td valign="top" class="value">${fieldValue(bean:personInstance, field:'name')}</td>
                        </tr>
                    
                        <tr class="prop">
                            <td valign="top" class="name">分類:</td>
                            <td  valign="top" style="text-align:left;" class="value">
                                <g:each var="r" in="${personInstance.categoryTags}">
                                    ${r.category.name}
                                </g:each>
                            </td>
                        </tr>
                        
                        <tr class="prop">
                            <td valign="top" class="name">項目:</td>
                            <td  valign="top" style="text-align:left;" class="value">
                                <g:each var="r" in="${personInstance.sportTags}">
                                    ${r.sport.name}
                                </g:each>
                            </td>
                        </tr>
                        
                         <tr class="prop">
                            <td valign="top" class="name">語言:</td>
                            <td valign="top" class="value">${fieldValue(bean:personInstance, field:'language')}</td>
                        </tr>
                        
                        <tr class="prop">
                            <td valign="top" class="name">電話:</td>
                            <td valign="top" class="value">${fieldValue(bean:personInstance, field:'phone')}</td>
                        </tr>
                        
                        <tr class="prop">
                            <td valign="top" class="name">電郵:</td>
                            <td valign="top" class="value">${fieldValue(bean:personInstance, field:'email')}</td>
                        </tr>
                        
                        <tr class="prop">
                            <td valign="top" class="name">應出席活動:</td>
                            <td  valign="top" style="text-align:left;" class="value">
                            	<table>
                            	<tr><td>名稱</td><td>簽到</td><td>簽退</td><td>時間(分)</td></tr>
                                <g:each var="r" in="${personInstance.records}">
                                <tr>
                                	<td>
                                    	<g:link controller="activity" action="show" id="${r.activity.id}">${r?.activity.name}</g:link>
                                    </td>
                                    <td>
                                    	<g:if test="${r.status != Status.NONREGISTERED.toString() && r.registerDate.getYear() > 70 }">
                                    		${ r.registerDate }
                                    	</g:if>
                                    </td>
                                    <td>
                                    	<g:if test="${r.status == Status.DONE.toString() || r.status == Status.OTHERDONE.toString()}">
                                    		${ r.doneDate }
                                    	</g:if>
                                    </td>
                                    <td>
                                    	<g:if test="${ r.registerDate.getYear() > 70 && r.doneDate.getYear() > 70 }">
                                    		${ r.period/(1000*60) }
                                    	</g:if>
                                    	<g:if test="${ r.registerDate.getYear() == 70 || r.doneDate.getYear() == 70 }">
                                    		--
                                    	</g:if>
                                    </td>
                                </tr>
                                </g:each>
                                </table>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
            <div class="buttons">
                <g:form>
                    <input type="hidden" name="id" value="${personInstance?.id}" />
                    <span class="button"><g:actionSubmit class="edit" value="編輯" action="edit"/></span>
                    <span class="button"><g:actionSubmit class="delete" onclick="return confirm('Are you sure?');" value="刪除" action="delete" /></span>
                </g:form>
            </div>
        </div>
    </body>
</html>
